package com.micro.modual.extension;

import com.micro.common.MicroConstant;
import com.micro.common.biz.GeneratorCodeUtil;
import com.micro.common.util.SnowFlakeUtil;
import com.micro.modual.entity.UserAddress;
import com.micro.modual.model.bo.useraddress.UserAddressBO;

/**
 * <h1>用户地址表 延展类</h1>
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:23:26
 */
public class UserAddressExtension {

    /**
     * <h2>转换: 用户地址表 新增</h2>
     * @param userAddressBO {@link UserAddressBO} 用户地址表 新增/修改 请求对象
     * @return {@link UserAddress} 用户地址表
     */
    public static UserAddress converAddUserAddress(UserAddressBO userAddressBO) {
        UserAddress userAddress = new UserAddress();
        userAddress.setId(SnowFlakeUtil.getId());
                                                            userAddress.setUserCode(userAddressBO.getUserCode());
                                                    userAddress.setReceiverName(userAddressBO.getReceiverName());
                                                    userAddress.setReceiverPhone(userAddressBO.getReceiverPhone());
                                                    userAddress.setProvinceName(userAddressBO.getProvinceName());
                                                    userAddress.setCityName(userAddressBO.getCityName());
                                                    userAddress.setAreaName(userAddressBO.getAreaName());
                                                    userAddress.setDetailedAddress(userAddressBO.getDetailedAddress());
                                                    userAddress.setPostalCode(userAddressBO.getPostalCode());
                                                    userAddress.setIsDefault(userAddressBO.getIsDefault());
                                                    userAddress.setCreateTime(userAddressBO.getCreateTime());
                                                    userAddress.setUpdateTime(userAddressBO.getUpdateTime());
                            return userAddress;
    }

    /**
     * <h2>转换: 用户地址表 修改</h2>
     * @param userAddressBO {@link UserAddressBO} 用户地址表 新增/修改 请求对象
     * @return {@link UserAddress} 用户地址表
     */
    public static UserAddress converEditUserAddress(UserAddressBO userAddressBO) {
        UserAddress userAddress = new UserAddress();
        userAddress.setId(userAddressBO.getId());
                                                        userAddress.setUserCode(userAddressBO.getUserCode());
                                                userAddress.setReceiverName(userAddressBO.getReceiverName());
                                                userAddress.setReceiverPhone(userAddressBO.getReceiverPhone());
                                                userAddress.setProvinceName(userAddressBO.getProvinceName());
                                                userAddress.setCityName(userAddressBO.getCityName());
                                                userAddress.setAreaName(userAddressBO.getAreaName());
                                                userAddress.setDetailedAddress(userAddressBO.getDetailedAddress());
                                                userAddress.setPostalCode(userAddressBO.getPostalCode());
                                                userAddress.setIsDefault(userAddressBO.getIsDefault());
                                                userAddress.setCreateTime(userAddressBO.getCreateTime());
                                                userAddress.setUpdateTime(userAddressBO.getUpdateTime());
                            return userAddress;
    }
}
